package com.hansming.bss.modules.sfc.service;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hansming.bss.common.service.CrudService;
import com.hansming.bss.modules.sfc.dao.LineDatePriceDao;
import com.hansming.bss.modules.sfc.entity.LineDatePrice;

/**
 * 站点Service
 * @author Hansming
 * @version 2017-09-19
 */
@Service
@Transactional(readOnly = true)
public class LineDatePriceService extends CrudService<LineDatePriceDao,LineDatePrice> {
	
	@Autowired
	private LineDatePriceDao lineDatePriceDao;
	
	//预留根据线路分支（车型）接口得到价格集合
	public List<LineDatePrice> selectByLineBranchId(String id){
		return lineDatePriceDao.selectByLineBranchId(id);
	}
	
	//根据线路id得到价格集合
	public List<LineDatePrice> selectByLineId(String id){
		return lineDatePriceDao.selectByLineId(id);
	}
	
	//根据日期和lineid得到价格
	public LineDatePrice getByDate(LineDatePrice linedateprice){
		return lineDatePriceDao.getByDate(linedateprice);
	}
		
	//根据日期和线路id更改价格(注更改状态为不是只读)
	@Transactional(readOnly = false)
	public void updateByDate(LineDatePrice linedateprice){		 
		lineDatePriceDao.updateByDate(linedateprice);
	}
	
	
	//根据线路分支储存价格
	@Transactional(readOnly= false)
	public void savelinedatepricebylingbranch(String id,String datetime,BigDecimal adult_price,BigDecimal child_price,String line_branch_id){
		lineDatePriceDao.savelinedatepricebylingbranch(id,datetime, adult_price, child_price, line_branch_id);
	}
	
	public LineDatePrice selectbydateandbranchid(String date,String id){
		return lineDatePriceDao.selectbydateandbranchid(date, id);
	}
	
	@Transactional(readOnly= false)
	public void updatelinebranchpricebydateandbranchid(String datetime,BigDecimal adult_price,BigDecimal child_price,String line_branch_id){
		lineDatePriceDao.updatelinebranchpricebydateandbranchid(datetime, adult_price, child_price, line_branch_id);
	}
	
	public List<LineDatePrice> selectthreepricebybranchid(String date,String id){
		return lineDatePriceDao.selectthreepricebybranchid(date, id);
	}
	
	
	
	//根据linebranchid和时间datetime得到价格
	public LineDatePrice selectBybridandtime(String id,String datetime){
		return lineDatePriceDao.selectBybridandtime(id, datetime);
	}
	
}
